Workaround a memory corruption issue on Windows Ruby 3.3#9420
Merged
Conversation
- Disclaimer: I honestly wasn't able to understand the problem and why this solution works. I don't have a windows machine and relying on CI machines is a bit painful. When introducing ruby#9414, master CI started to fail only on windows 3.3. I confirmed that running the failing spec in isolation multiple times reproduce the problem consistently. The error being either a segfault or a Bundler error along the line of "Illformed requirement `~> false.1.3.pre`". I triggered some CI with debugging output and the corruption seem to happen when `version.release` is called. It somehow modifies the previously defined variable `segments` (it's not a mutation). This is the debugging output I added 6a147a0 and the associated CI run is at https://github.com/Shopify/rubygems/actions/runs/23465022092/job/68275229509#step:7:177 Pasting here in case the CI log get cleared: ``` segments variable is [0, 12, 3, "pre"]. Object ID is 25820 version.segments is [0, 12, 3, "pre"]. ======== AFTER ======== Segments is [-1, 12, 3, "pre"]. Object ID is 25820 version.segments is [0, 12, 3, "pre"]. ``` In this patch, I opted to reference the `version.segments` object directly, again, I don't know why it fixes the issue.
Member
|
🙏 Thanks! It seems the tests passed, so I'll merge it and try it out in the next release. |
hsbt
approved these changes
Mar 25, 2026
hsbt
added a commit
that referenced
this pull request
Apr 7, 2026
Workaround a memory corruption issue on Windows Ruby 3.3 (cherry picked from commit f1cf945)
hsbt
added a commit
that referenced
this pull request
Apr 7, 2026
Workaround a memory corruption issue on Windows Ruby 3.3 (cherry picked from commit f1cf945)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Disclaimer: I honestly wasn't able to understand the problem and why this solution works. I don't have a windows machine and relying on CI machines is a bit painful.
What was the end-user or developer problem that led to this PR?
When introducing #9414, master CI started to fail only on windows 3.3. I confirmed that running the failing spec in isolation multiple times reproduce the problem consistently.
What is your fix for the problem, implemented in this PR?
The error being either a segfault or a Bundler error along the line of "Illformed requirement
~> false.1.3.pre".I triggered some CI with debugging output and the corruption seem to happen when
version.releaseis called. It somehow modifies the previously defined variablesegments(it's not a mutation).This is the debugging output I added Shopify@6a147a0 and the associated CI run is at https://github.com/Shopify/rubygems/actions/runs/23465022092/job/68275229509#step:7:177
Pasting here in case the CI log get cleared:
In this patch, I opted to reference the
version.segmentsobject directly, again, I don't know why it fixes the issue.Make sure the following tasks are checked
cc @hsbt Feel free to close this one as I understand that Ruby 3.3 is on security maintenance only. I figured it could prevent users on 3.3 from not being able to use Bundler as I suspect they will encounter this problem. Though, sorry that I'm not able to provide a concrete explanation as to why this happens. Computers ... 😮💨